package org.jeecg.modules.solitaire_app.app.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.sun.org.apache.regexp.internal.RE;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.solitaire_app.app.entity.YsyOilCityPrice;
import org.jeecg.modules.solitaire_app.app.mapper.YsyOilCityPriceMapper;
import org.jeecg.modules.solitaire_app.app.service.IYsyOilCityPriceService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 全国油价表
 * @Author: jeecg-boot
 * @Date:   2024-04-07
 * @Version: V1.0
 */
@Service
@DS("ysy_db")
public class YsyOilCityPriceServiceImpl extends ServiceImpl<YsyOilCityPriceMapper, YsyOilCityPrice> implements IYsyOilCityPriceService {

    @Override
    public Result<List<YsyOilCityPrice>> getYsyOilCityPrices() {
        Result<List<YsyOilCityPrice>> result = new Result<>();
        try {
            List<YsyOilCityPrice> ysyOilCityPrices = this.baseMapper.getYsyOilCityPrices();
            result.setSuccess(true);
            result.setCode(200);
            result.setResult(ysyOilCityPrices);
            return result;
        }catch (Exception e){
            result.setSuccess(false);
            result.setCode(500);
            result.setMessage("服务器响应失败");
            return result;
        }
    }
}
